﻿using Architecture.Repository.Interface.Traceability;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Traceability.Domain;

namespace Architecture.Repository.Impl.Traceability
{
    public class ShoppingRepository : BaseRepository<Shopping>, IShoppingRepository
    {
        public ShoppingRepository(EFCoreContext context) : base(context)
        {
        }

        /// <summary>
        /// 添加商品信息
        /// </summary>
        /// <param name="shopping">商品实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> AddShopping(Shopping shopping)
        {
            return await base.AddAsync(shopping);
        }

        /// <summary>
        /// 查询商品列表
        /// </summary>
        /// <returns>返回商品列表</returns>
        public async Task<List<Shopping>> GetShoppings()
        {
            return await base.GetAllAsync();
        }

        /// <summary>
        /// 反填商品信息
        /// </summary>
        /// <param name="shoppingId">商品主键</param>
        /// <returns>返回商品信息</returns>
        public async Task<Shopping> GetShoppingModel(int shoppingId)
        {
            return await base.GetModelAsync(shoppingId);
        }

        /// <summary>
        /// 修改商品信息
        /// </summary>
        /// <param name="shopping">商品实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> UpdateShopping(Shopping shopping)
        {
            return await base.UpdateAsync(shopping);
        }

    }
}
